import { DisposeView } from "../../../mvc/core/DisposeView";
import { ILayOut } from "../../../../modules/interfaces/ILayOut";
import { LayerManager } from "../../manager/LayerManager";
import { DataEvent } from "../../events/DataEvent";
import { Cache } from "../../cache/Cache";
import { Global } from "../../../../com/gengine/global/Global";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { EventName } from "../../mvc/EventName";
import { ObjCreate } from "../common/ObjCreate";
import { SecTimerView } from "../common/SecTimerView";
import { Language } from "../../../../extend/language/Language";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { FilterConst } from "../../../component/gconst/FilterConst";
type int = number;
//class AttachedSoulBattlefieldWaitingTimeView
    
    export  class AttachedSoulBattlefieldWaitingTimeView extends DisposeView implements ILayOut
    {
        constructor()
        {
            super();
            layer = LayerManager.msgTipLayer;
            this.resetPosition();
            return;
        }

        /* internal  */onStageResize(arg1: DataEvent): void
        {
            this.resetPosition();
            return;
        }

        /* internal  */onSecViewTimeChange(arg1: DataEvent): void
        {
            Cache.instance.attachedSoulBattlefield.joinCoolTime = int(arg1.data);
            return;
        }

        public resetPosition(): void
        {
            this.x = (Global.stage.stageWidth - 300) / 2;
            this.y = 90;
            return;
        }

        public set time(arg1: int)
        {
            this._coolTime.setLeftTime(arg1);
            return;
        }

        public stop(): void
        {
            this._coolTime.stop();
            return;
        }

        public /* override */ hide(): void
        {
            this._coolTime.stop();
            super.hide();
            Dispatcher.removeEventListener(EventName.StageResize, this.onStageResize);
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show(arg1, arg2);
            Dispatcher.addEventListener(EventName.StageResize, this.onStageResize);
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            this.mouseEnabled = false;
            this.mouseChildren = false;
            pushUIToDisposeVec(ObjCreate.createBg(0, 0, 300, 45, this, "ToolTipBg"));
            this._coolTime = new SecTimerView();
            this._coolTime.mouseEnabled = false;
            this._coolTime.setParse(Language.getString(28622));
            this._coolTime.defaultTextFormat = new GTextFormat(FontUtil.songtiName, 14, GlobalStyle.color6Uint, null, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._coolTime.filters = [FilterConst.glowFilter];
            this._coolTime.configEventListener(EventName.SecViewTimeChange, this.onSecViewTimeChange);
            ObjCreate.setObjAttri(this._coolTime, 0, 14, 300, 38, this);
            pushUIToDisposeVec(this._coolTime);
            return;
        }

        /* internal */ /* var */_coolTime: SecTimerView;
    }
